package org.example.demo20240504.feign;

import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @ClassName DemoFeign
 * @Description TODO
 * @Author huarujin
 * @Date 2024/5/4 15:54
 * @Version 1.0
 */
@Slf4j
@Component
public class DemoFeign {

    /**
     * 用 http 请求暂时替代 feign，正式环境下 请用 openfeign 或 dubbo 替代
     */
    String PREFIX = "http://localhost:10002/rpc/demoOrder";

    public void finish(Long id, Integer status) {
        HttpResponse response = HttpRequest.post(PREFIX + "/finish?id=" + id + "&status=" + status).execute();
        String body = response.body();
        log.info("producer 响应 {}", body);
    }

}
